#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace XmlRpc {
class XmlRpcConnection;
class XmlRpcResponse;
class XmlRpcIntrospect;
}

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void keyPressEvent (QKeyEvent *event);

private:
    QList<QVariant> parseParams(const QString &text);
    void displayResult(const QVariant &result, const QString &header = "");
    bool updateUrl();

    Ui::MainWindow *ui;
    XmlRpc::XmlRpcConnection *m_con;
    XmlRpc::XmlRpcIntrospect *m_introspect;

private slots:
    void on_browseButton_clicked();
    void on_executeButton_clicked();
    void on_helpButton_clicked();
    void on_loadButton_clicked();
    void on_refreshButton_clicked();
    void on_signatureButton_clicked();
    void on_filenameEdit_textChanged(QString newText);

    void methodHelpReceived(const QString &helpText);
    void methodListReceived(QStringList methods);
    void methodSignatureReceived(const QVariant &signature);
    void rpcQueryCompleted(XmlRpc::XmlRpcResponse *response);
};

#endif // MAINWINDOW_H
